function goods_dataSearch() {
    clearErrorMsg();
    goods_search(1, "", "", "1",getPageSize("pageHead"));
    setSearchOrder("orderHead");
}
function goods_search(intCurPage, strOrderColumn, strOrder, strFlag, pageSize) {
    if(strFlag == "1") {
        ajaxRequest(getHost()+"goods/goodsList/search", {
            "curPage"       : intCurPage,
            "pageSize"      : pageSize,
            "GoodsCode"     : getValue("txtGoodsCode"),
            "GoodsName"     : getValue("txtGoodsName"),
            "PriceFrom"     : getValue("txtPriceFrom"),
            "PriceTo"       : getValue("txtPriceTo"),
            "FirstCatg"     : getSelectedValue("goodsFirstCATG"),
            "SecondCatg"    : getSelectedValue("goodsSecondCATG"),
            "StockNumFg"    : getValue("hidNumFg"),
            "StockNumFrom"  : getValue("txtNumFrom"),
            "StockNumTo"    : getValue("txtNumTo"),
            "Flag"          : strFlag
        }, goods_goodsListView);
    } else {
        ajaxRequest(getHost()+"goods/goodsList/search", {
            "curPage"       : intCurPage,
            "pageSize"      : pageSize,
            "orderColumn"   : strOrderColumn,
            "order"         : strOrder,
            "Flag"          : strFlag
        }, goods_goodsListView);
    }
}
function goods_setTextType(strfg){
    setValue("hidNumFg",strfg);
    if(strfg == "3") {
        setDisabled("txtNumFrom",false);
        setDisabled("txtNumTo",false);
    } else {
        setDisabled("txtNumFrom",true);
        setDisabled("txtNumTo",true);
    }
}
function goods_reset() {
    clearErrorMsg();
    setValue("txtGoodsCode","");
    setValue("txtGoodsName","");
    setValue("txtPriceFrom","");
    setValue("txtPriceTo","");
    setSelectedByValue("goodsFirstCATG","");
    setSelectedByValue("goodsSecondCATG","");
    setDisabled("goodsSecondCATG",true);
    document.getElementById("rdoNumAll").checked = true;
    setValue("txtNumFrom","");
    setValue("txtNumTo","");
}
function goods_goodsListView(data) {
    var arrMsg = new Array();
    if (data.count <= 0){
        
//        pageCreat(data.curPage,data.count,"pageFoot");
        setTableData("tblDataTable", data.searchData, null, null);
        pageCreat(1,data.count,"pageHead");
        arrMsg[arrMsg.length] = getMessage("ERR-100002");
    } 
    if(arrMsg.length>0){
        setErrorMsg(arrMsg, 600);
        return;
    }
    arrCols = new Array(
            "setRowNo(_rowno)",
            "setIcon(imageUrl, ICON)",
            "setGoodsCode(GOODS_CODE,GOODS_NO,)",
            "setGoodsName(GOODS_NAME,GOODS_NO,)",
            "setVariation(VARIATION,SIMVARIATION)",
            "SALES_PRICE",
            "STOCK_NUM",
            "SUPPLIERNUM",
            "setSup(NAME_GROUP,SIMNAME_GROUP)");
    arrColStyle = new Array(
            "text-align:center",
            "text-align:center",
            "text-align:center",
            "text-align:center",
            "text-align:center",
            "text-align:center",
            "text-align:center",
            "text-align:center",
            "text-align:center"
            );
    arrRows =new Array(
            "",
            "BListTableGray");
    pageCreat(data.curPage,data.count,"pageHead");
//    pageCreat(data.curPage,data.count,"pageFoot");
    setTableData("tblDataTable", data.searchData, arrCols, arrColStyle,false,arrRows);

    
}

function goods_add() {
    document.goodsListFrom.action = getHost() + "goods/goodsAddEdit/index";
    document.goodsListFrom.submit();
}
function setRowNo(_rowno) {
    var intCurPage  = getCurPage();
    var intPageSize = getPageSize();
    return (intCurPage - 1) * intPageSize + _rowno + 1;
}
function setIcon() {
    return "<img>";
}
function setGoodsCode(goodsCode,goodsNo) {
    return "<a  href=\"" + getHost()+"goods/goodsDetails/index/goodsNo/"+ goodsNo + "\">" + goodsCode + "</a>";
}
function setGoodsName(goodsName,goodsNo) {
    return "<a  href=\"" + getHost()+"goods/goodsDetails/index/goodsNo/"+ goodsNo + "\">" + goodsName + "</a>";
}
function setVariation(VARIATION,SIMVARIATION) {
    return "<span title = '" + VARIATION + "'>" + SIMVARIATION +"</span>";
}
function setSup(NAME_GROUP,SIMNAME_GROUP) {
    return "<span title = '" + NAME_GROUP + "'>" + SIMNAME_GROUP +"</span>";
}
function gotoPage(strPageContainerId, strOrderContainerId) {
    goods_search(getCurPage(strPageContainerId), getOrderColumn(strOrderContainerId), getOrder(strOrderContainerId), "2", getPageSize(strPageContainerId));
}

function firstPage(strPageContainerId, strOrderContainerId) {
    goods_search(getCurPage(strPageContainerId), getOrderColumn(strOrderContainerId), getOrder(strOrderContainerId), "2", getPageSize(strPageContainerId));
}

function prePage(strPageContainerId, strOrderContainerId) {
    goods_search(getCurPage(strPageContainerId), getOrderColumn(strOrderContainerId), getOrder(strOrderContainerId), "2", getPageSize(strPageContainerId));
}

function nextPage(strPageContainerId, strOrderContainerId) {
    goods_search(getCurPage(strPageContainerId), getOrderColumn(strOrderContainerId), getOrder(strOrderContainerId), "2", getPageSize(strPageContainerId));
}

function lastPage(strPageContainerId, strOrderContainerId) {
    goods_search(getCurPage(strPageContainerId), getOrderColumn(strOrderContainerId), getOrder(strOrderContainerId), "2", getPageSize(strPageContainerId));
}

function orderSearch(strPageContainerId, strOrderContainerId) {
    goods_search(getCurPage(strPageContainerId), getOrderColumn(strOrderContainerId), getOrder(strOrderContainerId), "2", getPageSize(strPageContainerId));
}
function sizeChangeSearch(strPageContainerId, strOrderContainerId) {
    goods_search(getCurPage(strPageContainerId), getOrderColumn(strOrderContainerId), getOrder(strOrderContainerId), "2", getPageSize(strPageContainerId));
}